package com.singleton;

/**
 * 认为最好的单例模式
 */
public class SingletonTest {
    public volatile static SingletonTest singleton;

    private SingletonTest(){}

    public static SingletonTest getSingleton(){
        if (null == singleton) {
            synchronized (SingletonTest.class) {
                if (null == singleton) {
                    singleton = new SingletonTest();
                }
            }
        }
        return singleton;
    }

    public   String geta() {
        return "111";
    }

/*    public static void main(String[] args) {
        String geta = SingletonTest.getSingleton().geta();
        System.out.println(geta);

    }*/

}
